package com.api.shopapi.mapper;


import com.api.shopapi.entity.NursingSchedulingDaytimeItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface NursingSchedulingDaytimeItemMapper {

    @Insert("insert  into nursing_scheduling_daytime_item " +
            "(NursingSchedulingDaytimeItemCode,NursingSchedulingDaytimeCode,NurseCode,NurseName,NurseAideCode,NurseAideName) " +
            "values (#{nursingSchedulingDaytimeItem.NursingSchedulingDaytimeItemCode} ,#{nursingSchedulingDaytimeItem.NursingSchedulingDaytimeCode} ,#{nursingSchedulingDaytimeItem.NurseCode} ," +
            "#{nursingSchedulingDaytimeItem.NurseName} ,#{nursingSchedulingDaytimeItem.NurseAideCode} ,#{nursingSchedulingDaytimeItem.NurseAideName} )")
    int insert(@Param("nursingSchedulingDaytimeItem") NursingSchedulingDaytimeItem nursingSchedulingDaytimeItem);

    @Update("update nursing_scheduling_daytime_item set NursingSchedulingDaytimeCode=#{nursingSchedulingDaytimeItem.NursingSchedulingDaytimeCode} ,NurseCode=#{nursingSchedulingDaytimeItem.NurseCode} ,NurseName=#{nurseSchedulingDaytimeItem.NurseName} ,NursingAideCode=#{nursingSchedulingDaytimeItem.NurseAideCode} ,NursingAideName=#{nursingSchedulingDaytimeItem.NurseAideName} where NursingSchedulingDaytimeItemCode=#{nursingSchedulingDaytimeItem.NursingSchedulingDaytimeItemCode}  ")
    int updateByNursingSchedulingDaytimeItemCode(@Param("nursingSchedulingDaytimeItem") NursingSchedulingDaytimeItem nursingSchedulingDaytimeItem);

    @Delete("delete from nursing_scheduling_daytime_item where NursingSchedulingDaytimeItemCode=#{nursingSchedulingDaytimeItemCode} ")
    int deleteByNursingSchedulingDaytimeItemCode(@Param("nursingSchedulingDaytimeItemCode") String nursingSchedulingDaytimeItemCode);

    @Select("select * from nursing_scheduling_daytime_item where NursingSchedulingDaytimeItemCode=#{nursingSchedulingDaytimeItemCode} limit 1")
    NursingSchedulingDaytimeItem getByNursingSchedulingDayTimeItemCode(@Param("nursingSchedulingDaytimeItemCode")String nursingSchedulingDaytimeItemCode);

    @Select("select * from nursing_scheduling_daytime_item where NursingSchedulingDaytimeCode=#{nursingSchedulingDaytimeCode}")
    List<NursingSchedulingDaytimeItem> getListByNursingSchedulingDayTimeCode(@Param("nursingSchedulingDaytimeCode")String nursingSchedulingDaytimeCode);

    @Delete("delete from nursing_scheduling_daytime_item where NursingSchedulingDaytimeCode=#{nursingSchedulingDaytimeCode} ")
    int deleteByNurseSchedulingDaytimeCode(String nursingSchedulingDaytimeCode);

    @Select("select * from nursing_scheduling_daytime_item where NursingSchedulingDaytimeCode=#{nursingSchedulingDaytimeCode} and NurseAideCode=#{nurseAideCode} limit 1")
    NursingSchedulingDaytimeItem getByNursingSchedulingDayTimeCodeAndNurseAideCode(@Param("nursingSchedulingDaytimeCode") String nursingSchedulingDaytimeCode, @Param("nurseAideCode") String nurseAideCode);

    @Select("select * from nursing_scheduling_daytime_item where NursingSchedulingDaytimeCode=#{nursingSchedulingDaytimeCode} and NurseCode=#{nurseCode} limit 1")
    NursingSchedulingDaytimeItem getByNursingSchedulingDayTimeCodeAndNurseCode(@Param("nursingSchedulingDaytimeCode") String nursingSchedulingDaytimeCode,@Param("nurseCode") String nurseCode);
}
